var InputExcel = {
    data: {},
    table: null,
    clean:null,
    tableid:"ExcelTable",
    choose: "true"
}


InputExcel.initColumn = function () {
    return [
        {field: 'selectItem', radio: true,visible:false},
        {title: '商品名称', field: 'goodName', visible: true, align: 'center', valign: 'middle',},
        {title: '商品分类', field: 'categoryType', visible: true, align: 'center', valign: 'middle'},
        {title: '商品描述', field: 'goodDescription', visible: true, align: 'center', valign: 'middle', sortable: false},
        {title: '商品图片', field: 'goodIcon', visible: true, align: 'center', valign: 'middle'},
        {title: '库存', field: 'goodInventory', visible: true, align: 'center', valign: 'middle', sortable: true},
        {title: '价格', field: 'goodPrice', visible: true, align: 'center', valign: 'middle', sortable: true},
        {title: '状态', field: 'productStatus', visible: true, align: 'center', valign: 'middle'},
    ];
};

/**
 * 导入
 */
InputExcel.inputDatabase=function () {

    if(!$.isEmptyObject(InputExcel.data)){
        var ajax = new $ax(Feng.ctxPath + "/goods/saveExcel", function (data) {
            for (var j in data) {
                if(j=="message"){
                    Feng.success(data[j]);
                }
            }

        });
        ajax.start();
    }else {
        Feng.error("请导入数据！")
    }
}

$(function () {
    var fileupload = new $ExcelUpload("upload", Feng.ctxPath + '/goods/Excelupload', "chooseList");
    fileupload.init();

    var defaultColunms = InputExcel.initColumn();
    var table = new BSTable(InputExcel.tableid, "/goods/skinlist", defaultColunms);
    table.setPaginationType("client");
    var queryData = {};
    queryData['choose'] = InputExcel.choose;
    //table.refresh({query: queryData});
    table.setQueryParams(queryData);
    InputExcel.table = table.init();
});